package com.example.xingzai.myapplication;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

public class TestActivity extends AppCompatActivity implements View.OnClickListener {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

        findViewById(R.id.back).setOnClickListener(this);
        findViewById(R.id.AB).setOnClickListener(this);

    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.d("TestActivity", "onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.d("TestActivity", "onResume");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.d("TestActivity", "onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d("TestActivity", "onDestroy");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.d("TestActivity", "onPause");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.d("TestActivity", "onRestart");
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.back:
                Intent intent01 = new Intent();
                intent01.setClass(TestActivity.this, MainActivity.class);
                TestActivity.this.startActivity(intent01);
                break;
            case R.id.AB:
                Intent intent02 = new Intent();
                intent02.setClass(TestActivity.this, BcActivity.class);
                TestActivity.this.startActivity(intent02);
                break;
            default:
                break;
        }
    }

}
